package com.sunwayworld.basemodule.business.qualitycontrol.qualitycontrolresult.resource.impl;

import com.alibaba.fastjson.JSONObject;
import com.sunwayworld.basemodule.business.qualitycontrol.qualitycontrolresult.bean.LimsQualitycontrolTestResultManageBean;
import com.sunwayworld.basemodule.business.qualitycontrol.qualitycontrolresult.resource.LimsQualitycontrolTestResultManageResource;
import com.sunwayworld.basemodule.business.qualitycontrol.qualitycontrolresult.service.LimsQualitycontrolTestResultManageService;
import com.sunwayworld.framework.data.page.Page;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@LogModule("质控结果数据整理表")
@RestController
@GikamBean
public class LimsQualitycontrolTestResultManageResourceImpl implements LimsQualitycontrolTestResultManageResource {

    @Autowired
    private LimsQualitycontrolTestResultManageService limsQualitycontrolTestResultManageService;

    @Override
    public LimsQualitycontrolTestResultManageService getService() {
        return limsQualitycontrolTestResultManageService;
    }

    @Log(value = "新增质控结果数据整理表", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Log(value = "按质控物批号、质控物水平、质控物项目名称分组，加上每组的结果平均数、结果标准差", type = LogType.SELECT)
    @Override
    public Page<LimsQualitycontrolTestResultManageBean> queriesDistinctRows(RestJsonWrapperBean wrapper) {
        return getService().selectDistinctRowsByCondition(wrapper);
    }

    @Override
    public JSONObject saveToManageSaveTable(RestJsonWrapperBean wrapper) {
        return getService().saveToManageSaveTable(wrapper);
    }

    @Override
    public JSONObject setRemoveStatus(RestJsonWrapperBean wrapperBean) {
        return getService().setRemoveStatus(wrapperBean);
    }
}
